var http = require('http');
var axios = require('@liepin/cnpm-js-axios-fe');
// http.createServer(function (req, res) {
//   res.writeHead(200, {'Content-Type': 'application/json;charset=utf-8;'});
//   // res.write('Hello World!');
//   res.end(JSON.stringify({ name: 'yaogang' }));
// }).listen(8080, function () {
//   console.log('server start.')
//   axios.get('http://localhost:8080').then((res) => {
//     console.log('http://localhost:8080', res)
//   })
//   // http.get('http://localhost:8080', function (res) {
//   //   console.log('http://localhost:8080/', res)
//   // })
// });
const unloginValue = {
  flag: 0, data: {}, msg: '没有登录', code: 5002,
};
http.createServer((req, res) => {
  res.setHeader('Content-Type', 'application/json;charset=utf-8');
  res.end(JSON.stringify(unloginValue));
}).listen(4444, async () => {
  const url = 'http://localhost:4444/';
  axios.get(url, {
    headers: {
      'X-Client-Type': 'web',
      // 'X-Fscp-Fe-Version': `${finalVersion}`,
      'X-Fscp-Version': `1.1`,
      // 'X-Fscp-Std-Info': `{"client_id": "${finalClientId}"}`,
      'X-Fscp-Bi-Stat': `{"location": "https://ats.duomian.com/"}`,
      'X-Requested-With': 'XMLHttpRequest',
    }
  }).then((res) => {
    console.log(res.data)
  }).catch((err) => {
    console.log(error)
  })
});